<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Binh
 * Date: 1/6/14
 * Time: 11:49 PM
 * To change this template use File | Settings | File Templates.
 */
use \Model;
class Controller_TopSong extends Controller{
    private $view;

    public function __construct(){
        //Cài đặt view
        $this->view = View::forge('home/layout');
        $this->view->head = View::forge('home/head');
        $this->view->header = View::forge('home/header');
        $this->view->footer = View::forge('home/footer');
        $this->view->layout_top_song = View::forge('home/layout_top_song');

        //Cài đặt biến toàn cục
        $this->view->set_global('site', 'layout_top_song');
    }

    private function set_layout($genre, $songs){
        $this->view->set_global('genre', $genre);
        $this->view->set_global('songs', $songs);

        return $this->view;
    }

    public function action_Viet_Nam(){
        return $this->set_layout("Việt Nam", \Model\Song::get_top_vn(10));
    }

    public function action_Nuoc_Ngoai(){
        return $this->set_layout("Nước Ngoài", \Model\Song::get_top_ngoai(10));
    }
}